<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib  prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="redis" uri="http://www.shopjsp.com/redisTag/functions" %>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<c:set var="basePath" value="${redis:getSysConfig('base_path_back')}"/>
<script type="text/javascript">
    /**
     * 自定义验证规则
     */
    function validateForm(){
        form.bootstrapValidator({
            message: "无效的值",
            feedbackIcons: {
                valid: "glyphicon glyphicon-ok",
                invalid: "glyphicon glyphicon-remove",
                validating: "glyphicon glyphicon-refresh"
            },
            fields: {
                remarks: {
                    validators: {
                        notEmpty: {message: "备注不可为空"},
                        stringLength: {max: 200,message: "备注最大长度为200"}
                    }
                }
            }
        });
    }

    /**
     * 审核
     */
	<shiro:hasPermission name="back_gotoDrawingPageList_check">
    function editInfo() {
        /**获取选中行的id**/
        var selectedRow = $("#tt").bootstrapTable('getSelections');
        if (selectedRow.length == 1) {
            if (selectedRow) {/**判断是否找到当前行，找到后异步形式从数据库中删除当前记录**/
                $("#btn_edit").attr("data-target", "#addOrEditModal");/**选中了记录后才可打开对应的模态框**/
                /**隐藏域**/
                $("#drawingId").val(selectedRow[0].drawingId);/**提现记录Id**/
                /**可见表单控件**/
                $("#saveIsPass").val(selectedRow[0].state);/**提现记录状态**/
                if (selectedRow[0].state == 1) {/**状态 1、已提交  2、已审核  3、已发放**/
                    $("#isPass_1").attr("checked", "checked");
                } else if (selectedRow[0].state == 2) {
                    $("#isPass_2").attr("checked", "checked");
                    $("#isPass_1").attr("disabled", "disabled");/**设置失效**/
                } else if (selectedRow[0].state == 3) {
                    $("#isPass_3").attr("checked", "checked");
                    $("#isPass_1").attr("disabled", "disabled");/**设置失效**/
                    $("#isPass_2").attr("disabled", "disabled");/**设置失效**/
                }
                $("#remarks").val(selectedRow[0].remarks);/**提现记录备注**/
            }
        } else {
            $("#btn_edit").attr("data-target", "");/**没有选中记录关闭对应的模态框**/
            showMsg("请选择一行记录！");
        }
    }
	</shiro:hasPermission>
</script>

<!--添加编辑模态框（Modal） -->
<div class="modal fade" id="addOrEditModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" data-backdrop="static" >
	<div class="modal-dialog" style="width:70%">
		<div class="modal-content">
			<div class="modal-header">
				<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
				<h5 class="modal-title" id="myModalLabel">会员余额提现审核</h5>
			</div>
			<div class="modal-body">
				<form id="form1"  method="post" action="${basePath}/back/customer/drawing/saveOrUpdateDrawingState.sjson">
					<input id="drawingId" type="hidden" name="drawingId" noclear="true"/>
					<table align="center" class="addOrEditTable table-bordered table" style="width:100%;">
						<tr>
							<td class="toright_td" width="150px"><span style="color:red">* </span>审核状态:&nbsp;&nbsp;</td>
							<td class="toleft_td" colspan="3">
								<label class="checkbox-inline">
									<input id="isPass_1"  type="radio" name="state" class="radioInput" value="1"/>&nbsp;已提交
								</label>
								<label class="checkbox-inline">
									<input id="isPass_2"  type="radio" name="state" class="radioInput" value="2"/>&nbsp;已审核
								</label>
								<label class="checkbox-inline">
									<input id="isPass_3"  type="radio" name="state" class="radioInput" value="3"/>&nbsp;已发放
								</label>
							</td>
						</tr>
						<tr>
							<td class="toright_td" width="150px"><span style="color:red">* </span>备注:&nbsp;&nbsp;</td>
							<td  class="toleft_td">
								<div class="form-group">
									<textarea class="form-control input-sm" type="text" id="remarks" name="remarks" placeholder="请输入备注"></textarea>
								</div>
							</td>
						</tr>
					</table>
				</form>
			</div>
			<div class="modal-footer">
				<button type="button" id="validateBtn" class="btn btn-primary"  onclick="submitForm()">保存</button>
				<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
			</div>
		</div><!-- /.modal-content -->
	</div><!-- /.modal -->
</div>
